//
//  CJSFootView.m
//  GoTraveling
//
//  Created by 陈金山 on 15/12/25.
//  Copyright © 2015年 开发华佗. All rights reserved.
//

#import "CJSFootView.h"

@interface CJSFootView ()

@property (nonatomic, retain) UILabel *timeLabel;

@property (nonatomic, retain) UIImageView *timeImage;

@property (nonatomic, retain) UIView *lineView;

@end

@implementation CJSFootView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor colorWithRed:0.98 green:0.97 blue:0.93 alpha:1];
        [self createSubViews];
    }
    return self;
}

- (void)createSubViews {
    
    self.lineView = [[UIView alloc] initWithFrame:CGRectMake(20, 0, SCREEN_WIDTH - 40, 1)];
    [self addSubview:self.lineView];
    
    self.timeImage = [[UIImageView alloc] initWithFrame:CGRectMake(20, 40, 20, 20)];
    self.timeImage.layer.cornerRadius = 10;
    self.timeImage.layer.masksToBounds = YES;
    [self addSubview:self.timeImage];
   
    self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(70, 0, SCREEN_WIDTH - 100, 100)];
    self.timeLabel.textColor = [UIColor colorWithRed:0.46 green:0.45 blue:0.44 alpha:1];
    [self addSubview:self.timeLabel];
}

- (void)setTime:(NSString *)time {
    
    _time = time;
    self.lineView.backgroundColor = [UIColor colorWithRed:0.88 green:0.87 blue:0.85 alpha:1];
    self.timeImage.image = [UIImage imageNamed:@"clock_gray_big"];
    NSString *str = [self.time substringToIndex:15];
    self.timeLabel.text = [[str stringByReplacingOccurrencesOfString:@"-" withString:@"."] stringByReplacingOccurrencesOfString:@"T" withString:@" "];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
